package com.pingan.haofang.searchcloud.common.auth;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 数据权限校验
 *
 * @author zhangbi
 * @date 2017/6/16
 * @since 1.0.0
 */
@Documented
@Constraint(validatedBy = DataAuthValidator.class)
@Target({METHOD, FIELD, PARAMETER})
@Retention(RUNTIME)
public @interface ValidDataAuth {

    /**
     * 数据类型
     *
     * @return
     */
    AuthDataType dataType();

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String message() default "data.access.forbidden";
}
